import Vue from 'vue'
import App from './App.vue'
import VueResource from 'vue-resource'
import VueRouter from 'vue-router'
import VueAwesomeSwiper from 'vue-awesome-swiper'
import VueLazyload from 'vue-lazyload'  //引入这个懒加载插件
/*全局变量*/
import global_ from './components/Global.vue';
Vue.prototype.GLOBAL = global_;

Vue.use(VueResource);
Vue.use(VueRouter);
Vue.use(VueAwesomeSwiper);
Vue.use(VueLazyload, {
    preLoad: 1.3,
    error: '/src/image/1392662591495_1140x0.gif',  //图像的src加载失败
    loading: '/src/image/1392662591495_1140x0.gif', //src的图像加载
    attempt: 1,
    listenEvents: [ 'scroll', 'mousewheel' ]
});
/*引入组件路由*/
var components ='components_v2';
import head from './components/head.vue';
import fruits from  './components/fruits.vue';
import seafood from './components/seafood.vue';
import special from  './components/special.vue';
import share from     './components/share.vue';
import recommend from  './components/recommend.vue';
import classification from './components/classification.vue';
import shop from './components/shop.vue';
import details from './components/details.vue';
import center from './components/center.vue';
import myorder from './components/myorder.vue';
import all from './components/all.vue';
import goods from './components/goods.vue';
import receipt from './components/receipt.vue';
import payment from './components/payment.vue';
import evaluate from './components/evaluate.vue';
import shopDetails from './components/shopDetails.vue';
import commodity from './components/commodity.vue';
import detail from  './components/detail.vue';
import shopEvaluate from './components/shopEvaluate .vue';
import list from './components/list.vue';
import searchFruits from  './components/searchFruits.vue';
import listDetail from './components/listDetail.vue';
import customerService from './components/customerService.vue';
import apply from './components/apply.vue';
import record from './components/record.vue';
import refund from './components/refund.vue';
import refundDetail from './components/refundDetail.vue';
import idea from './components/idea.vue';
import integral from './components/integral.vue';
import help from './components/help.vue';
import logistics from './components/logistics.vue';
import orderSuccess from './components/orderSuccess.vue';
import successfulTrade from './components/successfulTrade.vue';
import indexBox from  '../src/indexBox.vue';
import index from './components/index.vue';
import Orderdetails from './components/Orderdetails.vue';
/*优惠券*/
import Coupon from './components/Coupon.vue';
/*登录*/
import login from '../src/login.vue';
/*分享你页面*/
import shareLi from './components/shareLi.vue';
//个人中心资料页面
import personCenter from './components/personCcenter.vue';
/*个人中心地址首页*/
import addIndex from './components/addIndex.vue';
/*个人中心编辑的地址*/
import addressEd from './components/addressEd.vue';
/*个人中心新增地址*/
import addNew from './components/addNew.vue';
//个人中心绑定手机号
import  bindPhone from './components/bindPhone.vue';
//个人中心设置密码
import person_psd from './components/person_psd.vue';
//首页会员
import Member from './components/Member.vue';
import axios from "axios";
Vue.prototype.$ajax=axios;
//配置路由，定义路由
var myRoute=[
    {
        path:'/index',/*name:'indexBox',*/ component:indexBox,//首页

        children:[
            {
                path:'/',/*name:'indexBox',*/ component:index, /*meta: { keepAlive: true },*/
                children:[
                    {
                        path:'/head/recommend',
                        component:recommend,
                       /* meta: { keepAlive: true },*/
                    },
                    {
                        path:'/head/share',
                        component:share,
                    },
                    {
                        path:'/head/fruits',
                        component:fruits,
                       /* meta: { keepAlive: true },*/
                    },
                    {
                        path:'/head/seafood',
                        component:seafood,
                       /* meta: { keepAlive: true },*/
                    },
                    {
                        path:'/head/special',
                        component:special,
                       /* meta: { keepAlive: true },*/
                    },
                    {
                        path:'/head/recommend',
                        component:recommend,
                        /*meta: { keepAlive: true },*/
                    }
                ]
    }]},
    {   path:'/classification', name:'indexBox',//分类
        component:classification,
    },
    {
        path:'/shop',name:'app', component:shop
    },
    {
            path:'/details',///shop/adress/details
            /* name:'app',*/  //这里暂时修改
            component:details,

    },
    {path:'/Orderdetails',/*name:'app',*/component:Orderdetails},//订单详情页 //这里暂时修改

    { path:'/center', /*name:'app',*///个人中心 //这里暂时修改
        component:center,
    },
    {path:'/Member',component:Member},//首页会员
    {path:'/myorder', component:myorder, //订单详情的tab
        children:[
           {
               path: '/',
               redirect: '/myorder/all'
           },
           {
               path:'/myorder/all', component:all
           },
           {
               path:'/myorder/payment', component:payment
           },
           {
               path:'/myorder/goods', component:goods
           },
           {
               path:'/myorder/receipt', component:receipt
           },
           {
               path:'/myorder/evaluate', component:evaluate
           },
       ]
    },
    { path:'/list',component:list},//详情列表
/*分类页面跳转列表页面*/
    {path:'/shopDetails', component:shopDetails,
    children:[
        {
            path: '/',
            redirect: '/shopDetails/commodity'
        },
        {
            path:'/shopDetails/commodity', component:commodity,
        },
        {
            path:'/shopDetails/detail', component:detail
        },
        {
            path:'/shopDetails/shopEvaluate', component:shopEvaluate,
        },
    ]
    },
    {path:'/searchFruits',component:searchFruits},//搜索水果
    {path:'/listDetail',component:listDetail},
    {path:'/refund',component:refund},
    {path:'/idea',component:idea},
    {path:'/integral',component:integral},
    {path:'/help',component:help},
    {path:'/logistics',component:logistics},
    {path:"/orderSuccess",component:orderSuccess},
    {path:'/successfulTrade',component:successfulTrade},
    {path:'/refundDetail',component:refundDetail},
    {path:'/Coupon',component:Coupon},
    /*登录*/
    {path:'/login',component:login},
    /*分享礼页面*/
    {path:'/shareLi',component:shareLi},
    {path:'/personCenter',component:personCenter},//个人中心已登录状态个人资料
    {path:'/addIndex',component:addIndex},//个人中心地址首页
    {path:'/addressEd',component:addressEd},//个人中心地址编辑
    {path:'/addNew',component:addNew},//个人中心地址新增
    {path:'/bindPhone',component:bindPhone},//个人中心绑定手机号
    {path:'/person_psd',component:person_psd},//个人中心设置密码
    {path:'/customerService',component:customerService, //售后服务

     children:[
         {
             path: '/',
             redirect: '/customerService/apply'
         },
         {
             path:'/customerService/apply',component:apply
         },
         {
             path:'/customerService/record',component:record
         },
     ]
    },
    {path: '*', redirect: '/head/recommend' },

    ];
//实例化路由对象老老实实的写这个名字route
var routers=new VueRouter({
    mode: 'history',
    routes:myRoute
});
new Vue({
    el: '#app',
    router:routers,
    render: h => h(App)
})
